package days48;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class day37 {
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int nowThread = 0;
            int allThread = 0;
            HashMap<String,String> hashMap=new HashMap<>();
            scanner.nextLine();
            for (int i = 0; i < n; i++) {
                String line = scanner.nextLine();
                String[] strings = line.split(" ");
                if(strings[1].equals("connect")){
                    if(nowThread==0){
                        allThread++;
                    }else {
                        nowThread--;
                    }
                    hashMap.put(strings[0],strings[1]);
                }else if(strings[1].equals("disconnect")&&hashMap.get(strings[0]).equals("connect")){
                    nowThread++;
                }
            }
            System.out.println(allThread);
        }
    }

    public static void main2(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()) {
            int n=scanner.nextInt();
            String[] strings = new String[n];
            scanner.nextLine();
            for (int i = 0; i < n; i++) {
                strings[i] = scanner.nextLine();
            }
            Arrays.sort(strings);
            //采用标记删除法
            boolean[] flag = new boolean[n];
            for (int i = 0; i < strings.length; i++) {
                if(strings[i].equals(strings[i+1])
                ||strings[i+1].contains(strings[i])
                &&strings[i+1].charAt(strings[i].length())== '/'){
                    flag[i] = true;
                }
            }
            for(int i = 0; i < n; ++i){
                if(!flag[i]){
                    System.out.println("mkdir -p " + strings[i]);
                }
            }
            System.out.println();
        }
    }
    
}
